from frame_work import menu_list
from workspace.shikee.chuji import user, rebate_pwd, release, apply, submit_order, timer_task, rebate, submit_report, \
    audit_no_report, activity, apply_audit
from workspace.shikee.high_quality_goods import (
    release_high_quality,
    activity as quality_activity,
    apply as quality_apply,
    apply_audit as quality_apply_audit,
    task,
    audit_task, submit_order as quailty_submit_order, submit_report as quailty_submit_report, audit_no_report as quailty_audit_no_report,
    rebate as quailty_rebate
)
from workspace.shikee.modshow import release_modshow, activity as modshow_activity, modshow_apply, modshow_apply_audit, modshow_receive,modshow_send_goods, modshow_confirm_goods, modshow_submit, modshow_audit, modshow_return_goods, modshow_confirm_return_goods, modshow_rebate
from workspace.taotaofa import release_tfx


if __name__ == '__main__':
    # 这里必须加if __name__ == '__main__'作保护
    # 因为apply.main()等函数涉及进程process操作,window系统做了限制防止死循环
    while True:
        # 显示主菜单
        menu_list.goods_menu()
        # 选择
        choise = input("请输入您的选择: ")
        try:
            if choise == '1':
                while True:
                    menu_list.menu()
                    choise = input("请输入您的选择: ")
                    if choise in ('q', 'Q'):
                        break
                    if choise == '1':
                        release.main()
                    elif choise == '2':
                        activity.main()
                    elif choise == '3':
                        apply.main()
                    elif choise == '4':
                        modshow_apply_audit.main()
                    elif choise == '5':
                        submit_order.main()
                    elif choise == '6':
                        submit_report.main()
                    elif choise == '7':
                        audit_no_report.main()
                    elif choise == '8':
                        rebate_pwd.main()
                    elif choise == '9':
                        rebate.main()
                    elif choise == '10':
                        timer_task.main()
                    elif choise == '11':
                        user.main()
                    elif choise == '12':
                        release_tfx.main()
            elif choise == '2':
                # 精品活动流程
                while True:
                    menu_list.quality_menu()
                    choise = input("请输入您的选择: ")
                    if choise in ('q', 'Q'):
                        break
                    if choise == '1':
                        release_high_quality.main()
                    elif choise == '2':
                        quality_activity.main()
                    elif choise == '3':
                        quality_apply.main()
                    elif choise == '4':
                        quality_apply_audit.main()
                    elif choise == '5':
                        task.main()
                    elif choise == '6':
                        audit_task.main()
                    elif choise == '7':
                        quailty_submit_order.main()
                    elif choise == '8':
                        quailty_submit_report.main()
                    elif choise == '9':
                        quailty_audit_no_report.main()
                    elif choise == '10':
                        quailty_rebate.main()
            elif choise == '3':
                # 模特秀活动流程
                while True:
                    menu_list.modshow_menu()
                    choise = input("请输入您的选择: ")
                    if choise in ('q', 'Q'):
                        break
                    if choise == '1':
                        release_modshow.main()
                    elif choise == '2':
                        modshow_activity.main()
                    elif choise == '3':
                        modshow_apply.main()
                    elif choise == '4':
                        modshow_apply_audit.main()
                    elif choise == '5':
                        modshow_receive.main()
                    elif choise == '6':
                        modshow_send_goods.main()
                    elif choise == '7':
                        modshow_confirm_goods.main()
                    elif choise == '8':
                        modshow_submit.main()
                    elif choise == '9':
                        modshow_audit.main()
                    elif choise == '10':
                        modshow_return_goods.main()
                    elif choise == '11':
                        modshow_confirm_return_goods.main()
                    elif choise == '12':
                        modshow_rebate.main()
            elif choise == '0':
                print("欢迎再次使用 【联盟测试脚本】 V1.0，再见！")
                break
            else:
                print("您输入的选项有误或不存在，请再次输入!")
        except Exception as e:
            raise("error")
